public class letter {
    public static void main(String[] args) {
      getCount("adsJKJ3K21AfaAD134F13241d134134s141faAAFDF");
    }
    //统计字符串中，大写字母，小写字母，数字出现的次数
    public static void getCount(String str) {
      int upper = 0;
      int lower = 0;
      int digi = 0;
      for (int i = 0, len = str.length(); i < len; i++) {
        char c = str.charAt(i);
        if (c >= 'A' && c <= 'Z') {
          upper++;
        } else if (c >= 'a' && c <= 'z') {
          lower++;
        } else if (c >= '0' && c <= '9') {
          digi++;
        }
      }
      System.out.println("大写字母:" + upper); //大写字母:13
      System.out.println("小写字母:" + lower); //小写字母:9
      System.out.println("数字:" + digi);   //数字:20
    }
}

  
    
